<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
	<title>商品搜索-${setting.name}</title>
	[#include "/common/include.ftl"/]
	[#import "common/pagination.ftl" as p/]
	<link type="text/css" rel="stylesheet" href="${base}/resource/css/list.css">
	<script type="text/javascript" src="${base}/resource/js/list.js"></script>
	<script type="text/javascript">
		$(function() {
			/**
			 * 商品收藏
			 */
			$(".collect").click(function () {
				var _this = $(this);
				ajax({
					url: base + "/member/addFavorite.jhtml",
					data: {goodsIds: $(this).attr("product-id")},
					showError: true,
					cache: false,
					success: function(data) {
						oDialog.prompt("商品收藏成功!");
						_this.addClass("collected");
					}
				});
			});
			
			$(".add-cart").click(function() {
				var _this = $(this);
				addCartSlide(_this, 1, _this.attr("goodsId"), _this.attr("imgUrl"));
			});
		});
	</script>
</head>
<body class="customer">
	[#include "/common/header.ftl"/]
    <div class="body w">
        <div class="list-crumb">
            <ul class="filter fl">
                [#if selectedCatList?? && selectedCatList?size > 0]
                    [#list selectedCatList as catSelector]
                        [#if catSelector??]
							[#if catSelector_index = 0]
                                <li class="home">
                                	<a href="${base}${(catSelector.url)}"><i></i><span>${(catSelector.name)!''}</span></a>
								</li>
							[#else]
								<li class="down">
									<div class="down-ico">
										<a href="javascript:"><span>${(catSelector.name)!''}</span><i></i></a>
									</div>
									[#if catSelector.brothers?? && catSelector.brothers?size > 0]
									<ul class="list-wrap">
										[#list catSelector.brothers as brother]
										 <li><a href="${base}${brother.url}" title="${(brother.name)!''}">${(brother.name)!''}</a></li>
										[/#list]
									</ul>
									[/#if]
								</li>
							[/#if]
							[#if catSelector_has_next]
                                <li class="left-ico"></li>
                            [/#if]
                        [/#if]
                    [/#list]
                [/#if]
				[#if selectorList?? && selectorList?size>0]
					<li class="left-ico"></li>
					<li class="selected">
					[#if selectorMap.getJSONArray('brandList').size() = 1]
						[#assign brandSltor = selectorMap.getJSONArray('brandList')[0] /]
						[#if brandSltor.isSelected?? && brandSltor.isSelected]
							<a href="${base}${(brandSltor.url)!''}.jhtml">品牌: ${brandSltor.name}<i></i></a>
						[/#if]
					[/#if]
					
					[#if selectorList?? && selectorList?size>0]
		                [#list selectorList as selector]
		                    [#assign selectors = selectorMap.getJSONArray(selector.key) /]
		                    [#if selectors.size() = 1]
								[#assign sltor = selectors[0] /]
								[#if sltor.isSelected?? && sltor.isSelected]
									<a href="${base}${(sltor.url)!''}.jhtml">${selector.name}: ${(sltor.name)!''}<i></i></a>
								[/#if]
		                    [/#if]
		                [/#list]
		            [/#if]
					</li>
				[/#if]
            </ul>
            <div class="goods-total-num fr">共${(pager.totalCount)!'0'}条</div>
            <div class="clear"></div>
        </div>

        <div class="filter-wrap">
            [#if selectorMap?? && selectorMap.getJSONArray('brandList').size() > 0]
				[#if selectorMap.getJSONArray('brandList').size() == 1 && selectorMap.getJSONArray('brandList')[0].isSelected?? && selectorMap.getJSONArray('brandList')[0].isSelected]
				[#else]
	            <dl class="brand-list">
	                <dt>品牌</dt>
	                <dd class="f-list">
	                    <ul class="fl ls s">
	                        [#list selectorMap.getJSONArray('brandList') as brandSelector]
								<li>
                                    <a href="${base}${(brandSelector.url)!''}.jhtml">
                                        <img class="lazy" title="${brandSelector.name}" data-original="[@Pic pic='${brandSelector.icon}' /]" width="104" height="52">
                                    </a>
                                </li>
	                        [/#list]
	                    </ul>
	                    <div class="more fr"><a href="javascript:" class="more-button up">更多</a></div>
	                </dd>
	            </dl>
				[/#if]
            [/#if]
            [#if selectorMap?? && selectorMap.getJSONArray('catList').size() > 0]
            <dl>
                <dt>分类</dt>
                <dd class="f-list">
                    <ul class="fl ls s">
                        [#list selectorMap.getJSONArray('catList') as catSelector]
                            [#if catSelector.isTopGoodsCategory?? && catSelector.isTopGoodsCategory]
                                <li><a href="${base}${(catSelector.url)!''}.jhtml" [#if catSelector.isSelected?? && catSelector.isSelected]class="hover"[/#if]>${(catSelector.name)!''}</a></li>
                            [#else]
                            [/#if]
                        [/#list]

                        [#list selectorMap.getJSONArray('catList') as catSelector]
                            [#if catSelector.isTopGoodsCategory?? && catSelector.isTopGoodsCategory]
                            [#else]
                                <li><a href="${base}${(catSelector.url)!''}.jhtml" [#if catSelector.isSelected?? && catSelector.isSelected]class="hover"[/#if]>${(catSelector.name)!''}</a></li>
                            [/#if]
                        [/#list]
                    </ul>
                    <div class="more fr"><a href="javascript:" class="more-button up">更多</a></div>
                </dd>
            </dl>
            [/#if]
            [#if selectorList?? && selectorList?size>0]
                [#list selectorList as selector]
                    [#assign selectorJSONArray = selectorMap.getJSONArray(selector.key) /]
                    [#if selectorJSONArray.size() > 0]
						[#if selectorJSONArray.size() = 1 && selectorJSONArray[0].isSelected?? && selectorJSONArray[0].isSelected]
						[#else]
                        <dl>
                            <dt>${(selector.name)!''}</dt>
                            <dd class="f-list">
                                <ul class="fl ls s">
                                [#list selectorJSONArray as selectorJSONObject]
                                    <li>
                                        <a href="${base}${selectorJSONObject.url}.jhtml" title="${(selectorJSONObject.name)!}" class="w-max">
                                            <span class="[#if (selectorJSONObject.isSelected)?? && selectorJSONObject.isSelected]current[/#if]">
                                                ${(selectorJSONObject.name)!''}
                                                [#if (selectorJSONObject.isSelected)?? && selectorJSONObject.isSelected]
                                                    &nbsp;
                                                [#else]
                                                    (${(selectorJSONObject.count)!''})
                                                [/#if]
                                            </span>
                                        </a>
                                    </li>
                                [/#list]
                                </ul>
								<div class="more fr"><a href="javascript:" class="more-button up">更多</a></div>
                            </dd>
                        </dl>
						[/#if]
                    [/#if]
                [/#list]
            [/#if]
        </div>
        <div class="main mt10">
            <div class="slide-left fl">
                <div class="left-wrap">
                    <div class="mt">
                        <h2>热卖推荐</h2>
                    </div>
                    <div class="mc">
                        <ul>
                        [@b2c_goods_list hasStock=true cateCode=cateCode count=4 orderBy="views desc"]
                            [#if !goodsList?has_content]
                                [@b2c_goods_list hasStock=true count=4 orderBy="views desc"]
                                    [#list goodsList as bean]
                                        <li>
                                            <i class="host"></i>
                                            <div class="img">
                                                <a target="_blank" href="${base}/goods/${bean.id}.jhtml">
                                                    <img class="lazy" data-original="[@Pic pic=bean.image_default postfix="164x170"/]" postfix="164x170" width="164" height="170">
                                                </a>
                                            </div>
                                            <p class="price"><em>￥</em><span>${currency(bean.price,false)}</span></p>
                                            <p class="name"><a href="${base}/goods/${bean.id}.jhtml" target="_blank"><strong></strong><span>${bean.name}&nbsp;${bean.spec}</span></a></p>
                                        </li>
                                    [/#list]
                                [/@b2c_goods_list]
                            [#else]
                                [#list goodsList as bean]
                                    <li>
                                        <i class="host"></i>
                                        <div class="img">
                                            <a target="_blank" href="${base}/goods/${bean.id}.jhtml">
                                                <img class="lazy" data-original="[@Pic pic=bean.image_default postfix="164x170"/]" width="164" height="170">
                                            </a>
                                        </div>
                                        <p class="price"><em>￥</em><span>${currency(bean.price,false)}</span></p>
                                        <p class="name"><a href="${base}/goods/${bean.id}.jhtml" target="_blank"><strong></strong><span>${bean.name}&nbsp;${bean.spec}</span></a></p>
                                    </li>
                                [/#list]
                            [/#if]
                        [/@b2c_goods_list]
                        </ul>
                    </div>
                </div>
            </div>
            <div class="slide-right fr">
                <div id="fixed-search">
                    <div class="search-logo"></div>
                </div>
                <div class="fliter-tools">
                    <ul class="filter-list fl">
                    [#if selectorMap?? && selectorMap.getJSONArray('sortList').size() > 0]
                        [#list selectorMap.getJSONArray('sortList') as sortSelector]
                            <li class="[#if sortSelector.isSelected?? && sortSelector.isSelected]select[/#if] ico
                                [#if (sortSelector.name)?substring(2)='PriceDesc']
                                    down-ico up
                                [#elseif (sortSelector.name)?substring(2)='PriceAsc']
                                    down-ico down
                                [/#if]
                            ">
                                <a href="[#if sortSelector.isSelected?? && sortSelector.isSelected && sortSelector.name?substring(0,2) != '价格']javascript:;[#else]${base}${(sortSelector.url)!''}.jhtml[/#if]">
                                    <span>${(sortSelector.name)?substring(0,2)}</span><i></i>
                                </a>
                            </li>
                        [/#list]
                    [/#if]
					[#--
                        <li>
                            <div class="checkbox-wrap">
                                <p>
                                    <label>
                                        <input type="checkbox"><span>医卡通</span>
                                    </label>
                                    <label>
                                        <input type="checkbox"><span>包邮</span>
                                    </label>
                                    <label>
                                        <input type="checkbox"><span>促销</span>
                                    </label>
                                </p>
                            </div>
                        </li>
					--]
                    </ul>
                    <div class="t-pages fr">
                        <div class="page-nums"><strong>${(pager.pageNumber)!1}</strong><span>/${(pager.pageCount)!1}</span></div>
                        <div class="page-btns">
                            <a href="javascript:[#if pager.pageNumber>1]page_search_go2(${pager.pageNumber-1})[/#if];" class="prev [#if pager.pageNumber = 1]disabled[/#if]"></a>
                            <a href="javascript:[#if pager.pageNumber<pager.pageCount]page_search_go2(${pager.pageNumber+1})[/#if];" class="next [#if pager.pageNumber = pager.pageCount]disabled[/#if]"></a>
                        </div>
                    </div>
                </div>
                <div class="clear"></div>
                [#if pager?? && pager.list?has_content]
                <ul class="product-list">
                    [#list pager.list as goods]
                    <li class="product-item">
                        <div class="img">
                            <a href="${base}/goods/${goods.id}.jhtml" target="_blank">
                                <img class="lazy" alt="${(goods.tip)!goods.name}" title="${(goods.tip)!goods.name}" data-original="[@Pic pic=goods.image_default postfix='200x200'/]" postfix="200x200" width="200" height="200">
                            </a>
                        </div>
                        <p class="price"><span>￥</span><strong>${currency(goods.price,false)}</strong></p>
                        <div class="name">
                        	 <a href="${base}/goods/${goods.id}.jhtml" target="_blank">
                            	<p class="title">${goods.name} ${goods.spec}/${goods.packingUnit}</p>
                            	<p class="detail">${(goods.tip)!''}</p>
							</a>
						</div>
                        <div class="jl">
                            <p class="fl"><span>该款成交</span><strong> ${(goods.sales)!0}笔</strong></p>
                            <p class="fr"><span>评论</span><strong>${(goods.cmts)!0}</strong></p>
                            <div class="clear"></div>
                        </div>
                        <div class="cz">
                            <a class="add-cart fl" goodsId="${goods.id}" imgUrl="[@Pic pic=goods.image_default postfix=''/]" href="javascript:;">加入购物车</a>
							<a href="${base}/goods/${goods.id}.jhtml" target="_blank" class="look-info fr">查看详情</a>
                            <div class="clear"></div>
                        </div>
                    </li>
                    [/#list]
                    <li class="clear"></li>
                </ul>
                <div class="pager">
                    [@p.pager pager = pager url = "${base}${uri}.jhtml"/]
                </div>
                [#else]
                    <div class="list-empty"><span class="nf-icon"></span>
                        <div class="nf-content"><span>抱歉，没有找到相关的商品</span>
                        </div>
                    </div>
                [/#if]
            </div>
            <div class="clear"></div>
        </div>
    </div>
	[#include "common/footer-slidebar-lazyload.ftl"]
</body>
</html>